/////////////////////////////////////////////////////////////////////////////
// Name:        xmlparser.h
// Purpose:     Anthemion XML parser utilities
// Author:      Julian Smart
// Modified by:
// Created:     2008-11-18
// RCS-ID:      $Id$
// Copyright:   (c) Julian Smart
// Licence:     New BSD License
/////////////////////////////////////////////////////////////////////////////

#ifndef __XMLPARSERH__
#define __XMLPARSERH__

/**
 @class wxXMLParser

 An XML parser base class
 */

class wxXmlNode;

class wxXMLParser
{
public:

    wxXMLParser() { Init(); }
    void Init() {}

    /// Check to see if a parameter exists.
    bool HasParam(wxXmlNode *node, const wxString& param);

    /// Finds the node or returns NULL.
    wxXmlNode *GetParamNode(wxXmlNode *node, const wxString& param);
    
    /// Gets node content from wxXML_ENTITY_NODE
    wxString GetNodeContent(wxXmlNode *node);

    /// Finds the parameter value or returns the empty string.
    wxString GetParamValue(wxXmlNode *node, const wxString& param);

    // Gets text from param and does some conversions:
    /// @li replaces \n, \r, \t by respective chars (according to C syntax)
    /// @li replaces _ by & and __ by _ (needed for _File => &File because of XML)
    /// @li calls wxGetTranslations (unless disabled in wxXmlResource)
    wxString GetText(wxXmlNode *node, const wxString& param);

    /// Find all strings with the given tag
    wxArrayString FindValues(wxXmlNode* node, const wxString& tag);

protected:
};

#endif
    // __XMLPARSERH__
